package com.cakin.javademo;

import java.lang.*;

/**
 * @ClassName: PrimitiveTypeTest
 * @Description: 基本数据类型测试
 * @Date: 2020/6/12
 * @Author: cakin
 */
public class PrimitiveTypeTest {
    public static void main(String[] args) {
        // byte
        System.out.println("byte的大小是：" + Byte.SIZE);
        System.out.println("最小值" + Byte.MIN_VALUE);
        System.out.println("最大值" + Byte.MAX_VALUE);
        byte a = 100;
        byte b = -60;
        System.out.println("a=" + a + "b=" + b);

        // short
        System.out.println("基本类型：short 二进制位数：" + Short.SIZE);
        System.out.println("包装类：java.lang.Short");
        System.out.println("最小值：Short.MIN_VALUE=" + Short.MIN_VALUE);
        System.out.println("最大值：Short.MAX_VALUE=" + Short.MAX_VALUE);
        System.out.println();
        short c = 90;
        short d = -100;
        System.out.println("c=" + c + "d=" + d);

        // int
        System.out.println("基本类型：int 二进制位数：" + Integer.SIZE);
        System.out.println("包装类：java.lang.Integer");
        System.out.println("最小值：Integer.MIN_VALUE=" + Integer.MIN_VALUE);
        System.out.println("最大值：Integer.MAX_VALUE=" + Integer.MAX_VALUE);
        System.out.println();
        int e = 80;
        int f = -67;
        System.out.println("e=" + e + "f=" + f);

        // long
        System.out.println("基本类型：long 二进制位数：" + Long.SIZE);
        System.out.println("包装类：java.lang.Long");
        System.out.println("最小值：Long.MIN_VALUE=" + Long.MIN_VALUE);
        System.out.println("最大值：Long.MAX_VALUE=" + Long.MAX_VALUE);
        System.out.println();
        long r = 98;
        long g = -89;
        System.out.println("r=" + r + "g=" + g);

        // float
        System.out.println("基本类型：float 二进制位数：" + Float.SIZE);
        System.out.println("包装类：java.lang.Float");
        System.out.println("最小值：Float.MIN_VALUE=" + Float.MIN_VALUE);
        System.out.println("最大值：Float.MAX_VALUE=" + Float.MAX_VALUE);
        System.out.println();
        float l = 89.3f;
        System.out.println("l=" + l);

        // double
        System.out.println("基本类型：double 二进制位数：" + Double.SIZE);
        System.out.println("包装类：java.lang.Double");
        System.out.println("最小值：Double.MIN_VALUE=" + Double.MIN_VALUE);
        System.out.println("最大值：Double.MAX_VALUE=" + Double.MAX_VALUE);
        System.out.println();
        double k = 89.9E12;
        System.out.println("k=" + k);

        // char
        System.out.println("基本类型：char 二进制位数：" + Character.SIZE);
        System.out.println("包装类：java.lang.Character");
        // 以数值形式而不是字符形式将Character.MIN_VALUE输出到控制台
        System.out.println("最小值：Character.MIN_VALUE="
                + (int) Character.MIN_VALUE);
        // 以数值形式而不是字符形式将Character.MAX_VALUE输出到控制台
        System.out.println("最大值：Character.MAX_VALUE="
                + (int) Character.MAX_VALUE);
        char j = 'J';
        System.out.println("J=" + j);
        System.out.println("=====================================");
        byte b1 = 12;
        // PI 是常量
        // 3.1415927 字面量
        final double PI = 3.1415927;
        final String MY_COMPUTER = "IBM";
        byte ai = 8;
        // 八进制表示法，0表示
        int h = 043;
        System.out.println("=====================================");
        System.out.println("h=" + h);
        // 十六进制表示法，0x表示
        int op = 0x43;
        System.out.println("op" + op);


        /**
         * "Hello World"
         * "two\nlines"
         * "\"This is in quotes\""
         */
        System.out.println("=====================================");
        String str1 = "two\nlines";
        String str2 = "\"This is in quotes\"";
        System.out.println(str1);
        System.out.println(str2);

        /**
         * char a = '\u0001';
         * String a = "\u0001";
         */
        char a2 = '\u0065';
        String a3 = "\u0065";
        System.out.println(a2);
        System.out.println(a3);
    }

}
